#ifndef PARSER_H
#define	PARSER_H
#include <istream>
#include "CodeMethod.h"
/*
 * I expect this class to be superseded by native smalltalk parser. And yes,
 * I do not want to use yacc .
 */
class Parser{
    public:
        Parser(Image* image);
        CodeMethod* parseMethod(istream& stream);
        //expression like message send, that spans basicaly till the end of the expression terminator '.'
        //or till the end of the parentheses,usually a message send
        Expression* parseExpr(istream& stream);
        //one self-enclosed expression like constant, variable or something in parens
        Expression* parseOneExpr(istream& stream);
        //does not consume the ending . ( ) [ ]
        Statement parseStatement(istream& stream);
        void skipStatementRemnants(istream& stream);
        void skipWhitespace(istream& stream);
    private:
        Image* image;
        string parseId(istream& stream);
};
#endif

